package domain

import (
	"context"
	"errors"
	"github.com/zeromicro/go-zero/core/logx"
	"listenboos-common/db"
	"ucenter/dao"
	"ucenter/model"
	"ucenter/repo"
)

type UserPaidAlbumDomain struct {
	userPaidAlbumRepo repo.UserPaidAlbumRepo
}

func (u *UserPaidAlbumDomain) FindPaidAlbum(ctx context.Context, userId int64, albumId int64) (paidAlbum *model.UserPaidAlbum, err error) {
	paidAlbum, err = u.userPaidAlbumRepo.FindPaidAlbum(ctx, userId, albumId)
	if err != nil {
		logx.Error(err)
		return nil, errors.New("数据库异常")
	}
	return paidAlbum, err
}
func NewUserPaidAlbumDomain(db *db.ListenDB) *UserPaidAlbumDomain {
	return &UserPaidAlbumDomain{
		userPaidAlbumRepo: dao.NewUserPaidAlbumDao(db),
	}
}
